convert object to array laravel

62

laravel transform object to array -

$users = App\User::all();
$users = $users->toArray();

laravel object to array -

function objectToArray(&$object)
{
    return @json_decode(json_encode($object), true);
}

Comments

Submit
0 Comments